package cc.comac.mom.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipDevAreaDefService;
import cc.comac.mom.bean.EquipDevAreaDef;
import cc.comac.mom.bean.EquipDevAreaDefBean;
import cc.comac.mom.datahandlers.entity.EquipDevAreaDefDataHandler;
import cc.comac.mom.util.ResultBean;
@RestController
@Service
public class EquipDevAreaDefServiceImpl implements EquipDevAreaDefService{

	@Autowired
	private EquipDevAreaDefDataHandler equipDevAreaDefDataHandler;
	@Override
	public ResultBean save(@RequestBody EquipDevAreaDef obj) {

		return equipDevAreaDefDataHandler.save(obj);
	}

	@Override
	public ResultBean update(@RequestBody EquipDevAreaDef obj) {

		return equipDevAreaDefDataHandler.update(obj);
	}

	@Override
	public ResultBean delete(@RequestBody EquipDevAreaDef obj) {

		return equipDevAreaDefDataHandler.delete(obj);
	}

	@Override
	public EquipDevAreaDef getById(@RequestBody EquipDevAreaDef obj) {

		return equipDevAreaDefDataHandler.getById(obj.getInnerData().getId());
	}

	@Override
	public EquipDevAreaDefBean selectByCondition(@RequestBody EquipDevAreaDef obj) {

		return equipDevAreaDefDataHandler.selectByCondition(obj);
	}

	@Override
	public List<EquipDevAreaDef> getAreaNameByEquipTypeId(@RequestParam long equipTypeId) {
		// TODO Auto-generated method stub
		return equipDevAreaDefDataHandler.getAreaNameByEquipTypeId(equipTypeId);
	}

	@Override
	public ResultBean getAreaNameByDevId(@RequestParam long id) {
		ResultBean resultBean = new ResultBean(true);
		List<EquipDevAreaDef> byDevId = equipDevAreaDefDataHandler.getAreaNameByDevId(id);
		resultBean.setObject(byDevId);		
		return resultBean;
	}

}
